package hsl.study.v3;


import hsl.study.biz.IUserService;
import hsl.study.biz.UserServiceImpl;
import hsl.study.v2.OrderService;

/**
 * @author HSL
 * @version 1.0
 * @data 2025/11/17 11:28
 * @desc todo
 */

public class GeneralTest {
    public static void main(String[] args) {
        // 情况 1：有接口（使用 JDK 代理）
        IUserService userService = new UserServiceImpl();
        IUserService userProxy = (IUserService) ProxyFactory.createProxy(userService);
        userProxy.addUser("小明");

        System.out.println("---------------------------");

        // 情况 2：无接口（使用 CGLIB 代理）
        OrderService orderService = new OrderService();
        OrderService orderProxy = (OrderService) ProxyFactory.createProxy(orderService);
        orderProxy.addOrder("ORD12345");
    }
}
